/*
** team.c for  in /home/faye_m//zappy
** 
** Made by mouhamed faye
** Login   <faye_m@epitech.net>
** 
** Started on  Wed Jun 22 20:49:36 2011 mouhamed faye
** Last update Sun Jul 10 12:13:45 2011 mouhamed faye
*/
#include <stdio.h>
#include <stdlib.h>
#include "team.h"
#include "types.h"

Class_team	*add_team(Class_team *req, char *team)
{
  Class_team *list_of_team;
  list_of_team = malloc(sizeof(Class_team) *  (MAX_TEAM + 2));
  if (list_of_team ==  NULL)
    {
      printf ("fonction add_command segfault segfault the zappy ....\n");
      exit(0);
    }
  list_of_team->team_name = team;
  list_of_team->nb_player += 1 ;
  list_of_team->max_player = MAX_TEAM;
  list_of_team->next = NULL;
  if (req == NULL)
    return (list_of_team);
  else
    {
      Class_team	*tmp = req;
      while (tmp->next != NULL)
	{
	  tmp = tmp->next;
	}
      tmp->next = list_of_team;
      return (req);
    }
}
